<template>
  <div class="page">
    
    <div class="title">
      <h1>demo</h1>
      <p>demo</p>
    </div>
    <div class="login-page">
      <div class="login-card">
        <h2>登录</h2>
        <el-form :model="loginForm" @submit.native.prevent="handleLogin">
          <el-form-item>
            <el-input v-model="loginForm.username" placeholder="请输入账号"></el-input>
          </el-form-item>
          <el-form-item>
            <el-input type="password" v-model="loginForm.password" placeholder="请输入密码"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" native-type="submit">登录</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>

</template>

<script>
import { ref } from 'vue';
import { ElMessage } from 'element-plus';

export default {
  setup() {
    const loginForm = ref({
      username: '',
      password: ''
    });

    const handleLogin = () => {
      // 在这里处理登录逻辑
      console.log('登录信息:', loginForm.value);
      ElMessage({
        message: '登录成功',
        type: 'success'
      });
    };

    return {
      loginForm,
      handleLogin
    };
  }
};
</script>

<style scoped>

.page
{
  display: grid;
  background-image: url('./img/background-image.png'); /* 替换为你的背景图片路径 */
  background-size: cover;
  height: 100vh;
}
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40%;

}

.title {
  margin-top: 10%; /* 添加下外边距 */
  margin-left: 10%; /* 添加下外边距 */
  height: 20%;
}

.title h1 {
  font-size: 24px;
  margin: 0;
}

.title p {
  font-size: 14px;
  color: #666;
  margin: 5px 0 0 0;
}

/* 登录卡片 */
.login-card {
  width: 300px;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

h2 {
  text-align: center;
  margin-bottom: 20px;
}
</style>
